package com.oplink.webems.modules.alarm.entity;

import java.util.List;


import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;

/**
 * Alarm Type Entity 
 * @author yizhang
 */
@Entity
@Table(name = "alarm_type")
@DynamicInsert @DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AlarmType {
	
	//ID
	private Long aid;
	
	//告警量
	private String alarmdesc;
	
	@JSONField(serialize=false)
	List<AlarmProp> plist = Lists.newArrayList();
	
	//List<CfgNe> netypelist = Lists.newArrayList();
	
	List<AlarmCurrent> aCurrentlist = Lists.newArrayList();

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)	
	public Long getAid() {
		return aid;
	}

	public void setAid(Long aid) {
		this.aid = aid;
	}

	public String getAlarmdesc() {
		return alarmdesc;
	}

	public void setAlarmdesc(String alarmdesc) {
		this.alarmdesc = alarmdesc;
	}

	@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="alarmtype")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)	
	@JsonIgnore
	public List<AlarmProp> getPlist() {
		return plist;
	}

	public void setPlist(List<AlarmProp> plist) {
		this.plist = plist;
	}

//	@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="netype")
//	@NotFound(action = NotFoundAction.IGNORE)
//	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)	
//	@JsonIgnore
//	public List<CfgNe> getNetypelist() {
//		return netypelist;
//	}
//
//	public void setNetypelist(List<CfgNe> netypelist) {
//		this.netypelist = netypelist;
//	}

	@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="atype")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)	
	@JsonIgnore	
	public List<AlarmCurrent> getaCurrentlist() {
		return aCurrentlist;
	}

	public void setaCurrentlist(List<AlarmCurrent> aCurrentlist) {
		this.aCurrentlist = aCurrentlist;
	}
	
	
	

}
